package com.biz.primus.model.coupon.vo.couponType;

import com.biz.primus.base.exception.utils.AssertUtils;
import com.biz.primus.model.coupon.exceptions.CouponTypeExceptionType;
import com.biz.primus.model.coupon.interfaces.IModelValidation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

/**
 * 更新优惠券类型信息接口
 *
 * @author david-liu
 */
@Getter
@Setter
public class UpdateCouponTypeInfoReqVo implements IModelValidation {

    // 券类型名称
    @ApiModelProperty(name = "couponTypeName", notes = "券类型名称", required = true)
    protected String couponTypeName;

    //优惠券类型介绍
    @ApiModelProperty(name = "couponTypeDesc", notes = "优惠券类型介绍")
    protected String couponTypeDesc;

    // 优惠券图片, 如果需要使用图片, 赋值
    @ApiModelProperty(name = "icon", notes = "优惠券图片; 如果未传, 使用默认的优惠券图片")
    protected String icon;

    // 优惠券备注信息
    @ApiModelProperty(name = "remark", notes = "优惠券备注信息")
    protected String remark;

    // 优惠券类型更新人
    @ApiModelProperty(name = "lastUpdateUser", notes = "优惠券类型更新用户")
    protected String lastUpdateUser;

    @Override
    public void validate() {
        Boolean filedHasValue = StringUtils.isNotBlank(couponTypeName) ||
                StringUtils.isNotBlank(couponTypeDesc) ||
                StringUtils.isNotBlank(icon) ||
                StringUtils.isNotBlank(remark) ||
                StringUtils.isNotBlank(lastUpdateUser);
        AssertUtils.isTrue(filedHasValue, CouponTypeExceptionType.PARAMETER_ILLEGAL, new Object[]{"参数字段不能全部为空"});
    }
}
